const cloud = require('wx-server-sdk')

cloud.init({ env: 'user-8gd9jrjnd1e10d35' }) // 使用当前云环境

exports.main = async (event, context) => {
  try {
    const db = cloud.database()
    const collection = db.collection('yonghu')
    const result = await collection.get()

    return result.data
  } catch (error) {
    console.error(error)
    throw error
  }
}
